package com.qiu.greened.network

import com.qiu.greened.bean.*
import retrofit2.http.*
import java.util.*

interface PostService {

//    @GET("post/nologin/hot")
//    suspend fun getNoLoginPostHot(@Query("page") page: Int,
//                                  @Query("limit") limit: Int
//    ) : BaseResponse<List<PostBean>>

    /**
     * 热门动态列表
     */
    @GET("post/hot")
    suspend fun getPostHot(@Header("Authorization") token: String,
                           @Query("userId") userId: Int,
                           @Query("page") page: Int,
                           @Query("limit") limit: Int
    ) : BaseResponse<List<PostBean>>

    /**
     * 关注动态列表
     */
    @GET("post/follow")
    suspend fun getPostByFollowUserId(@Header("Authorization") token: String,
                                      @Query("userId") userId: Int,
                                      @Query("page") page: Int,
                                      @Query("limit") limit: Int
    ) : BaseResponse<List<PostBean>>

    /**
     * 用户动态列表
     */
    @GET("post/user/{id}")
    suspend fun getPostByUserId(@Header("Authorization") token: String,
                            @Path("id") id: Int,
                            @Query("userId") userId: Int,
                            @Query("page") page: Int,
                            @Query("limit") limit: Int
    ) : BaseResponse<List<PostBean>>

    /**
     * 动态信息
     */
    @GET("post/{postId}")
    suspend fun getPost(@Header("Authorization") token: String,
                        @Path("postId") postId: Int,
                        @Query("userId") userId: Int,
    ) : BaseResponse<PostBean>

    /**
     * 添加动态
     */
    @POST("post/add")
    suspend fun addPost(@Header("Authorization") token: String,
                        @Body postDto: PostDto
    ) : BaseResponse<Objects>

    /**
     * 点赞动态
     */
    @POST("post/star")
    suspend fun setStar(@Header("Authorization") token: String,
                        @Body starBean: StarBean,
    ) : BaseResponse<Objects>

    /**
     * 评论动态
     */
    @POST("post/reply")
    suspend fun setReply(@Header("Authorization") token: String,
                         @Body replyPostBean: ReplyPostBean,
    ) : BaseResponse<Objects>

    /**
     * 动态评论列表
     */
    @GET("post/{postId}/reply")
    suspend fun getReply(@Header("Authorization") token: String,
                         @Path("postId") postId: Int,
                         @Query("page") page: Int,
                         @Query("limit") limit: Int
    ) : BaseResponse<List<ReplyBean>>

}